#include <iostream>
#include <string>
using namespace std;

bool isCutterIndex(string target, string cutter, int index) {
    for (int i = 0; i < cutter.size(); i++) {
        if (i + index > target.size() - 1) { return false; }
        if (target[index + i] != cutter[i]) { return false; }
    }
    return true;
}

int main() {
    string target; getline(cin, target);
    string cutter; getline(cin, cutter);
    // 由于一行里可能有空格，故使用getline()读取
    int cutterIndex = 0;
    while (target.size() > 0 && cutterIndex < target.size()) {
        if (isCutterIndex(target, cutter, cutterIndex)) {
            string curr = target.substr(0, cutterIndex);
            if (curr.size() > 0) { cout << curr << endl; }
            target = target.substr(cutterIndex + cutter.size());
            cutterIndex = 0;
        }
        else {
            cutterIndex++;
        }
    }
    if (target.size() > 0) { cout << target << endl; }
    return 0;
}